<?php

session_start();

require_once('twitter/lib/secret.php');
require_once('twitter/lib/EpiCurl.php');
require_once('twitter/lib/EpiOAuth.php');
require_once('twitter/lib/EpiTwitter.php');

$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

	if (isset($_POST['tweet'])) {
		
		$msg = $_POST['tweet'];
		
		//echo "'$_SESSION[ot]', '$_SESSION[ots]'";
		
		$twitterObj->setToken($_POST['ot'], $_POST['ots']);
		$update_status = $twitterObj->post_statusesUpdate(array('status' => $msg));
		$temp = $update_status->response;
		
		
		echo "<div align='center'>Updated your Timeline Successfully .</div>";
	}
	
	if (isset($_FILES['source'])) {
		$src = $_FILES['source']['tmp_name'];
		$update_status = $twitterObj->post('/account/update_profile_image.json', array('@image' => '@'.$src.';type=image/jpeg'));  
		$temp = $update_status->response;
		
		print_r($temp);
	}
	
}

?>